package com.lace.security.jwt.auth;

import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * Created by WangZX on 2018/7/14.
 */
public class UserContext {

	private final String userName;
	private final Collection<? extends GrantedAuthority> authorities;

	private UserContext(String userName, Collection<? extends GrantedAuthority> authorities) {
		this.userName = userName;
		this.authorities = authorities;
	}

	public static UserContext create(String userName, Collection<? extends GrantedAuthority> authorities) {
		return new UserContext(userName, authorities);
	}

	public String getUserName() {
		return userName;
	}

	public Collection<? extends GrantedAuthority> getAuthorities() {
		return authorities;
	}
}
